package cn.tedu.csmall.stock.webapi.mapper;


import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Repository
public interface StockMapper {
    // 减少指定商品库存的方法  注意:sql语句条件的理解
    @Update("update stock_tbl " +
            "set count=count-#{reduceCount} " +
            "where count>=#{reduceCount} " +
            "and " +
            "commodity_code=#{commodityCode}")
    void updateStockCountByCommodityCode(@Param("commodityCode") String commodityCode, @Param("reduceCount") Integer reduceCount);
}
